package books



import grails.test.mixin.*
import org.junit.*

/**
 * See the API for {@link grails.test.mixin.domain.DomainClassUnitTestMixin} for usage instructions
 */
@TestFor(Book)
class BookTests {

    void testBuildBook() {
		def validBook = new Book(title: "Old MacDonald had a farm", author: "Some guy", 
			description: "A story about a farmer and his animals", minGradeLevel: 0, isbn: '978-0-12-385059-1',
			maxGradeLevel: 6, language: "English", category: "General Leisure Reading")

		assertTrue validBook.validate()
		
		def invalidBook = new Book(description: "A story about a farmer and his animals", minGradeLevel: 0,
			maxGradeLevel: 6, language: "English", category: "General Leisure Reading")
		
		assertFalse invalidBook.validate()
    }
	
}
